﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="message-details.aspx.cs" Inherits="message_details" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" Runat="Server">
    <asp:SqlDataSource ID="dsMsgHistory" runat="server" ConnectionString="<%$ ConnectionStrings:AtlasDB %>"
        SelectCommand="SELECT 
  md.datetime_in as SendTime, 
  md.msg_size,
  mk.comments as MsgName,
  md.msg_cirkul,
  md.msg_id,
  e.comments as InfoCode,
  al.item as AliasName,
  h.item as HostName
FROM mon400_data md
INNER JOIN mon400_hostnames h ON md.hostname_id = h.id
INNER JOIN mon400_aliases al ON md.alias_sender_id = al.id
INNER JOIN mon400_errorcodes e ON md.msg_errorcode_id = e.id
INNER JOIN mon400_msg_kinds mk ON md.msg_kind = mk.item
WHERE
  (md.msg_id = @MsgID) 
  AND (md.from_abonent_id = @FromCode)
  AND (md.to_abonent_id = @ToCode)
  AND (al.item NOT IN (SELECT hst.comments FROM mon400_hostnames hst))
ORDER BY
   md.msg_kind, md.datetime_in" OnSelected="dsMsgHistory_Selected">
        <SelectParameters>
            <asp:Parameter DefaultValue="0" Name="MsgID" Type="String" />
            <asp:Parameter DefaultValue="0" Name="FromCode" Type="Int32" />
            <asp:Parameter DefaultValue="0" Name="ToCode" Type="Int32" />
        </SelectParameters>
    </asp:SqlDataSource>
    <asp:Label ID="lbApFrom" runat="server" Text="Отправитель: " Font-Bold="True"></asp:Label>
    </br>
    <asp:Label ID="lbApTo" runat="server" Text="Получатель: " Font-Bold="True"></asp:Label>
    <asp:GridView ID="gvMsgHistory" runat="server" AllowPaging="True" 
                        AutoGenerateColumns="False" Caption="История прохождения сообщения" 
                        CaptionAlign="Left" CellPadding="4" CellSpacing="1" DataSourceID="dsMsgHistory" 
                        EnableTheming="False" Font-Bold="False" ForeColor="Black" 
        PageSize="30">
        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <RowStyle BackColor="#EFF3FB" />
        <Columns>
                           <asp:BoundField DataField="SendTime" HeaderText="Отправлено" 
                                SortExpression="SendTime" >
                            <ItemStyle HorizontalAlign="Center" />
                            </asp:BoundField>
                            <asp:BoundField DataField="msg_size" HeaderText="Байт" 
                                SortExpression="msg_size" />
                            <asp:BoundField DataField="MsgName" HeaderText="Тип" />
                            <asp:BoundField DataField="InfoCode" HeaderText="Инфо" />
                            <asp:BoundField DataField="AliasName" HeaderText="Алиас" 
                                SortExpression="AliasName" />
                            <asp:BoundField DataField="HostName" HeaderText="Хост" 
                                SortExpression="HostName" />
        </Columns>
        <EditRowStyle BackColor="#2461BF" />
        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <AlternatingRowStyle BackColor="White" />
    </asp:GridView>
</asp:Content>

